<?php !defined('BASE_ROOT') && exit ( 'Access Denied!' );
class Controller extends CAI_Controller{

	/**
	 * 构造函数.
	 *
	 * @return void
	 * @access public
	 *
	 */
	public function __construct() {
		parent::__construct();
	}
	/**
	 * 判断权限
	 *
	 * @access public
	 */
	final protected function isaccess(){
		$u = $this->model('User');
		$p = $this->model('Privilege');
		$this->helper(array('cookie'));
		if($p->getroleprivilege(get_cookie('u_role'))){
			$msginfo = array (
				'msg' => '对不起，您无权访问该页！'
			);
			$this->assign($msginfo);
			$this->show('admin/message.php');
			exit;
		}
	}
	/**
	 * 判断登录
	 *
	 * @access public
	 */
	final protected function islogin(){
		$user = $this->model('User');
		if($user->islogin()){
			$msginfo = array (
				'msg' => '对不起，您还没有登录或登录超时！'
			);
			$this->assign($msginfo);
			$this->show('admin/message.php');
			exit;
		}
	}
}